<?php
header('Content-Type:text/html; Charset=UTF-8');
require 'lib/checker.php';

require 'lib/db.php';
@$types = dbSelectAll('select id,name from type order by id asc');

require 'lib/header.php';
?>
		<div class="container">
			<div class="row">
				<div class="col-xs-2">
					<a href="dishList.php" class="btn btn-primary btn-block">菜品列表</a>
                    <a href="main.php" class="btn btn-primary btn-block">返回首页</a>
				</div>
				<div class="col-xs-5">
					<div class="panel panel-primary">
						<div class="panel-heading">
							<div class="panel-title">
								<span class="glyphicon glyphicon-plus"></span> 添加菜品<span class="col-md-offset-8"></span>
							</div>
						</div>
						<form action="insertDish.php" method="post" enctype="multipart/form-data" class="form-horizontal">
							<div class="panel-body">
								<div class="form-horizontal">
									<div class="form-group">
	                                     <label class="col-xs-3 control-label">菜名：</label>
	                                     <div class="col-xs-7">
	                                          <input class="form-control" name="name" placeholder="菜名" />
	                                     </div>
	                                </div>
	                                <div class="form-group">
					                     <label class="control-label col-xs-3">单价：</label>
					                     <div class="col-xs-7">
					                         <input required="required" name="price" value="" type="number" min="1" class="form-control" placeholder="单价">
					                     </div>
					                </div>
					                <div class="form-group">
										<label class="col-xs-3 control-label" for="typeInput">类型：</label>
										<div class="col-xs-7">
											<select id="typeInput" name="type" class="form-control">
												<option value="请选择">请选择</option>
												<?php foreach ($types as $type) { ?>
													<option value="<?php echo $type['name'];?>"><?php echo $type['id']?>---<?php echo $type['name'];?></option>
												<?php } ?>
											</select>
										</div>
		                            </div>
		                            <div class="form-group">
		                                <label class="control-label col-xs-3">照片：</label>
										<div class="col-xs-7 ">
											<label class="sr-only" for="1113"></label>
											<div class="input-group">
											    <input name="img" type="file" class="filestyle" data-buttonBefore="true" data-buttonText="选择文件" /><br />
											</div>
										</div>
		                            </div>
								</div>
							</div>
							<div class="panel-foot">
								<div class="panel-footer">
						      		<button type="submit" class="btn btn-primary btn-lg btn-block">添加菜品</button>
						      	</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
   </body>
</html>
